package elasticsearch

import (
	"github.com/olivere/elastic/v7"
)

var (
	EsConfig esConfig
	EsClient *elastic.Client
)

type esConfig struct {
	Address    string `ini:"address"`
	WatchTopic string `ini:"watchTopic"`
	Index      string `ini:"index"`
}

func InitElasticSearch() (err error) {
	EsClient, err = elastic.NewClient(elastic.SetURL(EsConfig.Address))
	if err != nil {
		return
	}
	return
}
